/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lostreseditores.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author DILOVE
 */
@Entity
@Table(name = "esquemacalificacion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Esquemacalificacion.findAll", query = "SELECT e FROM Esquemacalificacion e"),
    @NamedQuery(name = "Esquemacalificacion.findByIdEsquema", query = "SELECT e FROM Esquemacalificacion e WHERE e.idEsquema = :idEsquema"),
    @NamedQuery(name = "Esquemacalificacion.findByValormin", query = "SELECT e FROM Esquemacalificacion e WHERE e.valormin = :valormin"),
    @NamedQuery(name = "Esquemacalificacion.findByValormax", query = "SELECT e FROM Esquemacalificacion e WHERE e.valormax = :valormax")})
public class Esquemacalificacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_esquema")
    private Integer idEsquema;
    @Basic(optional = false)
    @NotNull
    @Column(name = "valormin")
    private int valormin;
    @Basic(optional = false)
    @NotNull
    @Column(name = "valormax")
    private int valormax;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEsquema")
    private List<Examen> examenList;

    public Esquemacalificacion() {
    }

    public Esquemacalificacion(Integer idEsquema) {
        this.idEsquema = idEsquema;
    }

    public Esquemacalificacion(Integer idEsquema, int valormin, int valormax) {
        this.idEsquema = idEsquema;
        this.valormin = valormin;
        this.valormax = valormax;
    }

    public Integer getIdEsquema() {
        return idEsquema;
    }

    public void setIdEsquema(Integer idEsquema) {
        this.idEsquema = idEsquema;
    }

    public int getValormin() {
        return valormin;
    }

    public void setValormin(int valormin) {
        this.valormin = valormin;
    }

    public int getValormax() {
        return valormax;
    }

    public void setValormax(int valormax) {
        this.valormax = valormax;
    }

    @XmlTransient
    public List<Examen> getExamenList() {
        return examenList;
    }

    public void setExamenList(List<Examen> examenList) {
        this.examenList = examenList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEsquema != null ? idEsquema.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Esquemacalificacion)) {
            return false;
        }
        Esquemacalificacion other = (Esquemacalificacion) object;
        if ((this.idEsquema == null && other.idEsquema != null) || (this.idEsquema != null && !this.idEsquema.equals(other.idEsquema))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.lostreseditores.modelo.Esquemacalificacion[ idEsquema=" + idEsquema + " ]";
    }
    
}
